package com.woody.aggregate.infrastructure.msgsendrule.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woody.aggregate.infrastructure.msgsendrule.dto.MsgSendRuleInfoDTO;
import com.woody.aggregate.infrastructure.msgsendrule.entity.MsgSendRule;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 消息弹窗规则 Mapper 接口
 * </p>
 *
 * @author author
 * @since 2025-03-20
 */
public interface MsgSendRuleMapper extends BaseMapper<MsgSendRule> {

    /**
     * 查询绑定规则的分类id列表
     * <br />
     * @param categoryIds
     * @return
     */
    List<Integer> selectUsedCategoryIds(@Param("categoryIds") List<Integer> categoryIds);

    /**
     * 根据分类和规则名称查询规则列表
     * <br />
     * @param page
     * @param categoryId 可以为空
     * @param ruleName 可以为空
     * @return
     */
    Page<MsgSendRuleInfoDTO> pageQuerySendRule(Page page, @Param("categoryId") Integer categoryId, @Param("ruleName") String ruleName);

    /**
     * 根据规则id，查询规则详情
     * <br />
     * @param ruleId
     * @return
     */
    MsgSendRuleInfoDTO getMsgSendRuleDtoByRuleId(Integer ruleId);
}
